﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using RED_NET_Core.DAL;

namespace RED_NET_Core.BLL
{
    public class NewsFeed_BLL
    {
        #region[构造函数]

        public NewsFeed_BLL() 
        { 
            //构造函数
        }

        #endregion

        #region[好友相片最新动态信息，返回datatable]

        public DataTable GetNewsFeedOfPhotoOfFriends(int uid)
        {
            NewsFeed_DAL nfd = new NewsFeed_DAL();
            try
            {
                return nfd.GetNewsFeedOfPhotoOfUser(uid);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        #endregion

        #region[好友日志最新动态信息，返回datatable]

        public DataTable GetNewsFeedOfNewsOfFriends(int uid)
        {
            NewsFeed_DAL nfd = new NewsFeed_DAL();
            try
            {
                return nfd.GetNewsFeedOfNewsOfUser(uid);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        #endregion

        #region[学院内各班相片最新动态的dataset]

        public DataTable GetNewsFeedOfPhotoOfUsersByCollege(int tCollegeId)
        {
            NewsFeed_DAL nfd = new NewsFeed_DAL();
            try
            {
                return nfd.GetNewsFeedOfPhotoOfUsersByCollege(tCollegeId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        #endregion

        #region[返回学院内各班日志最新动态的datatable]

        public DataTable GetNewsFeedOfNewsOfUserByCollege(int tCollegeId)
        {
            NewsFeed_DAL nfd = new NewsFeed_DAL();
            try
            {
                return nfd.GetNewsFeedOfNewsOfUserByCollege(tCollegeId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion

        #region[返回各学院相片最新动态的datatable]

        public DataTable GetNewsFeedOfPhotoOfColleges()
        {
            NewsFeed_DAL nfd = new NewsFeed_DAL();
            try
            {
                return nfd.GetNewsFeedOfPhotoOfColleges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        #endregion

        #region[返回各学院日志最新动态的datatable]

        public DataTable GetNewsFeedOfNewsOfColleges()
        {
            NewsFeed_DAL nfd = new NewsFeed_DAL();
            try
            {
                return nfd.GetNewsFeedOfNewsOfColleges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        #endregion

        #region[返回最新动态(兼容全部要求)]

        /// <summary>
        ///  返回最新动态的信息
        /// </summary>
        /// <param name="iUId">调用该函数的UId</param>
        /// <param name="iCollegeId">调用该函数的iCollege（在搜索学院下班级信息时用到，不是用此功能则设置任何数都可）</param>
        /// <param name="iNumber">第n批的15个最新动态（页面下拉时增加信息用）</param>
        /// <param name="iGetWhatNewsFeed">取最新动态信息的种类，0为好友动态，1为学院下班级动态，2为学院动态</param>
        /// <returns></returns>
        public DataTable GetNewsFeed(int iUId, int iCollegeId, int iNumber, int iGetWhatNewsFeed)
        {
            NewsFeed_DAL nfd = new NewsFeed_DAL();
            try
            {
                return nfd.GetNewsFeed(iUId, iCollegeId, iNumber, iGetWhatNewsFeed);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        #endregion

        #region[增加动态]

        public bool InsertNewsFeed(int iBeOfUserId, int iType, string sName, string sContent, DateTime tUpdateTime,
            int iContentId, int iFatherId)
        {
            NewsFeed_DAL nfd = new NewsFeed_DAL();
            try
            {
                return nfd.InsertNewsFeed(iBeOfUserId, iType, sName, sContent, tUpdateTime, iContentId, iFatherId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        #endregion

        #region[删除动态]

        public bool DeleteNewsFeed(int iType, int iContentId)
        {
            NewsFeed_DAL nfd = new NewsFeed_DAL();
            try
            {
                return nfd.DeleteNewsFeed(iType,iContentId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        #endregion

    }
}
